package com.stars.home.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.databinding.DataBindingUtil
import com.stars.home.R
import com.stars.home.databinding.WidgetSearchBinding
import com.stars.home.vmodel.SearchVModel
import com.trailer.base.view.BView
import com.trailer.base.view.BaseView

/**
 * 搜索的布局
 *
 *on 2020/9/16
 */
class SearchView(context: Context, attrs: AttributeSet) : BaseLinearLayout(context, attrs) {
    var viewModel: SearchVModel? = null
        set(value) {
            binding?.vm = value
            field = value
        }
    private var binding: WidgetSearchBinding? = null
    private var view: BView? = null

    init {
        init(context)
    }

    private fun init(context: Context) {
        if (context is BaseView) {
            view = context as BView
        }
        binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.widget_search, this, true)

    }
}
